#ifndef  DBUTILS_H_
#define  DBUTILS_H_

#include <QObject>
#include <QWidget>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQuery>
#include <QMutex>

class DButils
{
public:

	static DButils * GetKernel();

	static void DestroyKernel();

	//bool DBconnect();
	void initTableStrut();
	QSqlQuery excuteSql(QString sql);
	bool ExecSqlLst(QStringList strSqlList);
	void SetDatabaseName(QString dbname);
	bool OpenDb();
	void CloseDb();

	bool ExecSql(QString strSql);
	void CheckAndCommitSQL();
private:
	DButils();
	~DButils();
	
private:
	QSqlDatabase m_db;
	static DButils * m_pKernel;
	QStringList        m_sqlLst;
	QMutex               m_mutex;
};

#endif